#ifndef COCCURANCE_H
#define COCCURANCE_H

#include <cstdio>
#include <cstdlib>
#include <math.h>
#include <fstream>
#include <iostream>
#include <QDebug>
#include "mytype.h"
using namespace std;

class Coccurance
{
public:
    Coccurance(int h, int w, int level);
    ~Coccurance();
    void setParam(int *data, int d);
    float avg_stat(int func);
    void reset();

private:
    void init();
    void build_list(int *data, int d);
    void find_insert(int x1, int x2, int angle);
    void calc_stat();
    void getAvgVar(int index, ListNode *node, float &avg, float &var);

    int height;                     // height of image
    int width;                      // width of image
    int nGray;                      // number of "gray" level
    float delta1, delta2, delta3;   // number of probability

    HashNode ***glchs;				// Array of co-occurrence probabilities
    ListNode **head;				// Head node of linked list of each angle
    ListNode **tail;				// Tail node of linked list of each angle
    Stat *stats;					// Texture features
};
#endif // COCCURANCE_H
